package pixivPc.ui;

import java.awt.FlowLayout;

import javax.swing.JPanel;

/**
 * 界面
 * @author wangm
 *
 */
public class Panel extends JPanel {

	/**
	 * 界面名
	 */
	private final String name;

	/**
	 * 
	 * @param name 界面名
	 */
	public Panel(String name) {
		super();
		this.name = name;
		this.setLayout(new FlowLayout());
		this.setVisible(true);
	}

	/**
	 * 自裁
	 */
	public void delete() {
		MainFrame main = (MainFrame) this.getParent();
		main.deletePanel(name);
	}

	/**
	 * 获取主界面
	 * @return 主界面
	 */
	public MainFrame getMain() {
		return (MainFrame) this.getParent().getParent().getParent().getParent();
	}
	
}
